﻿<WindowsControlsNavigation:Page x:Class="QuailDashboard.View.Views.Home" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:C1DateTimeEditors="clr-namespace:C1.Silverlight.DateTimeEditors;assembly=C1.Silverlight.DateTimeEditors" 
    xmlns:QuailControls="clr-namespace:QuailDashboard.View.Controls" 
    xmlns:SilverlightTools="clr-namespace:Divelements.SilverlightTools;assembly=Divelements.SilverlightTools"
    xmlns:WindowsControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    xmlns:WindowsControlsData="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
    xmlns:WindowsControlsNavigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
    xmlns:dataprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    Title="Quail Dashboard - Home"
    Style="{StaticResource PageStyle}">
    <UserControl.Resources>
        <DataTemplate x:Key="TestsTemplate" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="18" />
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Image
                    Grid.Row="0"
                    Grid.Column="0"
                    Width="16"
                    Height="16"
                    Source="{Binding StatusId, Converter={StaticResource StatusConverter}}" />
                <TextBlock
                    Grid.Row="0"
                    Grid.Column="1"
                    Text="{Binding Name}" />
            </Grid>
        </DataTemplate>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Style="{StaticResource ContentGridStyle}" Loaded="LayoutRoot_Loaded" Background="LightGray">
        <ScrollViewer x:Name="ContentScrollViewer" Style="{StaticResource PageScrollViewerInContentStyle}" SizeChanged="OnLayoutRootSizedChanged">
            <Grid VerticalAlignment="Top" x:Name="GridPage">
                <Grid.RowDefinitions>
                    <RowDefinition Height="0"/>
                    <RowDefinition x:Name="RowTestResults" MinHeight="150" MaxHeight="950" Height="175"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="Auto" MinHeight="120" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <!-- row containing the test class treeview & test result lists -->
                <Grid Grid.Row="1" Grid.Column="0" x:Name="TestResultsGrid" SizeChanged="OnLayoutRootSizedChanged">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition MinWidth="150" MaxWidth="400" Width="300" />
                        <ColumnDefinition Width="5" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <!-- start of grid containing test classname tree view -->
                    <Grid Grid.Row="0" Grid.Column="0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        
                        <StackPanel Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" Orientation="Horizontal">
                            <TextBlock VerticalAlignment="Center" Text="Results for " />
                            <Button x:Name="ButtonEnvironment" Click="Environment_Click" >
                                <TextBlock Text="{Binding SelectedEnvironmentDescription}" />
                            </Button>
                                
                            <Rectangle Style="{StaticResource FilterDividerStyle}"/>
                            <CheckBox
                                x:Name="FilterDateTimeEnabled"
                                Margin="0"
                                Checked="OnFilterDateTimeEnabled_Checked"
                                Unchecked="OnFilterDateTimeEnabled_Checked"
                                ToolTipService.ToolTip="Check this to filter the test results by date"
                                VerticalAlignment="Center" />
                            <C1DateTimeEditors:C1DateTimePicker
                                IsEnabled="False"
                                x:Name="FilterDateTime"
                                Margin="0"
                                EditMode="Date"
                                VerticalAlignment="Center"
                                ToolTipService.ToolTip="Select a date to filter test results"
                                DateTimeChanged="FilterDateTime_DateTimeChanged" />
                            <Rectangle Style="{StaticResource FilterDividerStyle}"/>
                            <Button Click="btnExecuteTestClass_Click"
                                                            VerticalAlignment="Center"
                                                            ToolTipService.ToolTip="Run all the tests for the selected test class" >
                                <Image Source="{StaticResource IconExecute}" Stretch="None"/>
                            </Button>
                        </StackPanel>

                        <QuailControls:VirtualizingTreeView
                            x:Name="TreeViewTests"
                            Background="White"
                            Grid.Row="1" Grid.Column="0"
                            ItemTemplate="{StaticResource TestsTemplate}"
                            SelectedItemChanged="TreeViewTests_SelectedItemChanged"
                            VerticalAlignment="Top"
                            HorizontalAlignment="Stretch"
                            HorizontalContentAlignment="Stretch"
                            VerticalContentAlignment="Stretch"
                            LayoutUpdated="TreeViewTests_LayoutUpdated"
                            ItemsSource="{Binding TestClassHeirarchyList}"
                            />
                    </Grid>
                    <!-- end of grid containing test classname tree view -->

                    <WindowsControls:GridSplitter Style="{StaticResource GridSplitterVerticalStyle}" Grid.Row="0" Grid.Column="1" />
                    
                    <!-- begin grid containing tests for selected testclass -->
                    <Grid
                        x:Name="RightSideGrid"
                        Grid.Row="0"
                        Grid.Column="2"
                        VerticalAlignment="Top">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        
                        <Grid Grid.Row="0" Grid.Column="0">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left">
                                <TextBlock Text="{Binding FilteredTestCount}" VerticalAlignment="Center" />
                                <TextBlock Text=" Test results for " VerticalAlignment="Center" />
                                <TextBlock Text="{Binding SelectedTestClassName}" VerticalAlignment="Center" />
                                <TextBlock Text=" library:" VerticalAlignment="Center" />

                                <TextBlock x:Name="txbMessage" Text=" " />
                                
                            </StackPanel>
                            <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
                                <Rectangle Style="{StaticResource FilterDividerStyle}"/>
                                <TextBlock Text="Filters:" VerticalAlignment="Center" />
                                <CheckBox x:Name="SelectAll" Click="Filter_All" Tag="All" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle all filters"></CheckBox>
                                <ToggleButton x:Name="FilterFail" Click="Filter_Click" Tag="Fail" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of failed test results" >
                                    <Image Source="{Binding FilterFailed, Converter={StaticResource FilterIconConverter}, ConverterParameter=Fail}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <ToggleButton x:Name="FilterFailYSOD" Click="Filter_Click" Tag="YSOD" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of YSOD test results" >
                                    <Image Source="{Binding FilterFailedYSOD, Converter={StaticResource FilterIconConverter}, ConverterParameter=YSOD}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <ToggleButton x:Name="FilterFailTimeout" Click="Filter_Click" Tag="Timeout" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of timeout test results" >
                                    <Image Source="{Binding FilterFailedTimeout, Converter={StaticResource FilterIconConverter}, ConverterParameter=Timeout}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <ToggleButton x:Name="FilterFailSync" Click="Filter_Click" Tag="Sync" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of Sync failure test results" >
                                    <Image Source="{Binding FilterFailedSync, Converter={StaticResource FilterIconConverter}, ConverterParameter=Sync}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <ToggleButton x:Name="FilterFailThirdParty" Click="Filter_Click" Tag="ThirdParty" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of 3rd party test results" >
                                    <Image Source="{Binding FilterFailedThirdParty, Converter={StaticResource FilterIconConverter}, ConverterParameter=ThirdParty}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <ToggleButton x:Name="FilterFailQuail" Click="Filter_Click" Tag="Quail" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of Quail failure test results" >
                                    <Image Source="{Binding FilterFailedQuail, Converter={StaticResource FilterIconConverter}, ConverterParameter=Quail}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <ToggleButton x:Name="FilterWarning" Click="Filter_Click" Tag="Warning" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of warning test results" >
                                    <Image Source="{Binding FilterWarning, Converter={StaticResource FilterIconConverter}, ConverterParameter=Warning}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <ToggleButton x:Name="FilterPending" Click="Filter_Click" Tag="Pending" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of pending test results" >
                                    <Image Source="{Binding FilterPending, Converter={StaticResource FilterIconConverter}, ConverterParameter=Pending}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <ToggleButton x:Name="FilterAsyncPending" Click="Filter_Click" Tag="AsyncPending" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of async pending test results" >
                                    <Image Source="{Binding FilterAsyncPending, Converter={StaticResource FilterIconConverter}, ConverterParameter=AsyncPending}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <ToggleButton x:Name="FilterPass" Click="Filter_Click" Tag="Pass" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Toggle filtering of passed test results" >
                                    <Image Source="{Binding FilterPassed, Converter={StaticResource FilterIconConverter}, ConverterParameter=Pass}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <Rectangle Style="{StaticResource FilterDividerStyle}"/>
                                <ToggleButton x:Name="Chromify" Click="Chromify_Click" Tag="Chromify" Margin="1,0,0,0" VerticalAlignment="Center" ToolTipService.ToolTip="Enable Chrome and FireFox mousewheel support" >
                                    <Image Source="{Binding FilterPassed, Converter={StaticResource FilterIconConverter}, ConverterParameter=Chrome}" Stretch="None" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ToggleButton>
                                <Rectangle Style="{StaticResource FilterDividerStyle}"/>
                                <TextBox x:Name="FilterBox" MinWidth="75" MaxWidth="150" Margin="1,0,0,0" KeyUp="FilterBox_KeyUp" ToolTipService.ToolTip="Enter any text to filter the test results" VerticalAlignment="Center" />
                                <Rectangle Style="{StaticResource FilterDividerStyle}"/>
                                <Button Margin="1,0,0,0" ToolTipService.ToolTip="Refresh all test results" Click="OnRefreshClick">
                                    <Image Source="{StaticResource IconRefresh}" Stretch="None"/>
                                </Button>

                            </StackPanel>
                        </Grid>
                        <WindowsControlsData:DataGrid 
                            x:Name="ResultGrid" 
                            Grid.Row="1" Grid.Column="0" 
                            AlternatingRowBackground="Beige" 
                            AutoGenerateColumns="False" 
                            CanUserResizeColumns="True"
                            SelectionChanged="ResultGrid_SelectionChanged" 
                            HorizontalScrollBarVisibility="Auto"
                            VerticalScrollBarVisibility="Auto"
                            Loaded="ResultGrid_Loaded"
                            >
                            <WindowsControlsData:DataGrid.Columns>
                                <WindowsControlsData:DataGridTemplateColumn IsReadOnly="False" >
                                    <WindowsControlsData:DataGridTemplateColumn.HeaderStyle>
                                        <Style TargetType="dataprimitives:DataGridColumnHeader">
                                            <Setter Property="ContentTemplate">
                                                <Setter.Value>
                                                    <DataTemplate>
                                                        <StackPanel
                                                            HorizontalAlignment="Center"
                                                            Orientation="Horizontal" >
                                                            <CheckBox x:Name="chkSelectAll"  Loaded="chkSelectAll_Loaded"   HorizontalAlignment="Center" VerticalAlignment="Center"  Checked="SelectTestCheckChanged" Unchecked="SelectTestCheckChanged"  />
                                                            <Button Name="btnExecuteTests" 
                                                                    Click="btnExecuteTests_Click"
                                                                    ToolTipService.ToolTip="Run checked tests">
                                                                <Image Source="{StaticResource IconExecute}" Stretch="None"/>
                                                            </Button>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </WindowsControlsData:DataGridTemplateColumn.HeaderStyle>
                                    <WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Grid >
                                                <StackPanel HorizontalAlignment="Center"
                                                            Orientation="Horizontal"
                                                            Visibility="{Binding IsExecuting, Converter={StaticResource InverseVisibilityConverter}}">
                                                    <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}"
                                                              HorizontalAlignment="Center"
                                                              VerticalAlignment="Center"
                                                              Checked="TestRun_Checked"
                                                              Unchecked="TestRun_Checked"  />
                                                    <Button Click="btnExecuteTest_Click"
                                                            VerticalAlignment="Center"
                                                            ToolTipService.ToolTip="Run this test" >
                                                        <Image Source="{StaticResource IconExecute}" Stretch="None"/>
                                                    </Button>
                                                </StackPanel>
                                                <Grid MaxHeight="25" MaxWidth="25">
                                                    <Grid.RenderTransform>
                                                        <TransformGroup>
                                                            <ScaleTransform ScaleX="0.25" ScaleY="0.25" />
                                                            <TranslateTransform  X="9" Y="9" />
                                                        </TransformGroup>
                                                    </Grid.RenderTransform>
                                                    <QuailControls:LoadingAnimation Visibility="{Binding IsExecuting, Converter={StaticResource VisibilityConverter}}"/>
                                                </Grid>
                                            </Grid>
                                        </DataTemplate>
                                    </WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                </WindowsControlsData:DataGridTemplateColumn>
                                <WindowsControlsData:DataGridTemplateColumn IsReadOnly="True" SortMemberPath="RunStatusOrdinal" Header="Result">
                                    <WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Image ToolTipService.ToolTip="{Binding RunStatus}"  Source="{Binding RunStatusId, Converter={StaticResource StatusConverter}}" Height="16" Width="16" Stretch="None" />
                                        </DataTemplate>
                                    </WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                </WindowsControlsData:DataGridTemplateColumn>
                                <WindowsControlsData:DataGridTemplateColumn IsReadOnly="True" SortMemberPath="HasNotes" Header="Notes">
                                    <WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel>
                                                <Button Click="NoteView_Click" Visibility="{Binding HasNotes, Converter={StaticResource VisibilityConverter}}" Height="20" Width="20" VerticalAlignment="Center">
                                                    <Image Source="{StaticResource IconNotes}" Stretch="Fill" />
                                                </Button>
                                                <StackPanel Visibility="Collapsed">
                                                    <Button Click="NoteView_Click" Visibility="{Binding HasNotesNewAndOld, Converter={StaticResource HasNewNotesConverter}}" Height="20" Width="20" VerticalAlignment="Center">
                                                        <Image Source="{StaticResource IconNotes}" Stretch="Fill" />
                                                    </Button>
                                                    <TextBlock Text="{Binding HasNotesNewAndOld}" />
                                                </StackPanel>
                                            </StackPanel>
                                        </DataTemplate>
                                    </WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                </WindowsControlsData:DataGridTemplateColumn>
                                <WindowsControlsData:DataGridTemplateColumn IsReadOnly="True" SortMemberPath="TestOwner" Header="Owner">
                                    <WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Height="20" Click="TakeOwnership_Click">
                                                <TextBlock Text="{Binding TestOwner, Converter={StaticResource TestOwnerConverter}}" />
                                            </Button>
                                        </DataTemplate>
                                    </WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                </WindowsControlsData:DataGridTemplateColumn>
                                <WindowsControlsData:DataGridTextColumn IsReadOnly="True" SortMemberPath="RunStartDate" Header="Started" Binding="{Binding RunStartDate, Converter={StaticResource RelativeDateConverter}}" />
                                <WindowsControlsData:DataGridTextColumn IsReadOnly="True" Header="Duration" Binding="{Binding Duration, Converter={StaticResource DurationConverter}}" />
                                <WindowsControlsData:DataGridTemplateColumn SortMemberPath="TestName" Header="Test Name">
                                    <WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding TestName, Converter={StaticResource TestNameConverter}}" VerticalAlignment="Center"/>
                                        </DataTemplate>
                                    </WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                    <WindowsControlsData:DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <TextBox Text="{Binding TestName}" GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus"/>
                                        </DataTemplate>
                                    </WindowsControlsData:DataGridTemplateColumn.CellEditingTemplate>
                                </WindowsControlsData:DataGridTemplateColumn>
                                <WindowsControlsData:DataGridTextColumn IsReadOnly="True" SortMemberPath="TestClassName" Binding="{Binding TestClassName}" Header="Namespace" />
                            </WindowsControlsData:DataGrid.Columns>
                        </WindowsControlsData:DataGrid>
                    </Grid>
                    <!-- end grid containing test results from selected test class-->
                </Grid>
                <!-- end test class content grid -->

                <WindowsControls:GridSplitter Style="{StaticResource GridSplitterHorizontalStyle}" Grid.Row="2" Grid.Column="0" />

                <!-- begin lower section, test results -->
                <WindowsControls:TabControl
                    x:Name="TestTabs"
                    Grid.Row="3"
                    Grid.Column="0"
                    HorizontalAlignment="Left"
                    SelectionChanged="TestTabs_SelectionChanged"
                    MinHeight="250">
                    <WindowsControls:TabItem x:Name="TabItemTestLogs">
                        <WindowsControls:TabItem.Header>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{StaticResource IconTest}" />
                                <TextBlock Margin="5,0,0,0" Text="Test Logs" />
                            </StackPanel>
                        </WindowsControls:TabItem.Header>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <QuailControls:TestRunLogsControl Grid.Row="0" Grid.Column="0" x:Name="TestRunLogs" RunStatusResult="{Binding SelectedTest}" />
                        </Grid>
                    </WindowsControls:TabItem>

                    <WindowsControls:TabItem x:Name="TabItemHistory">
                        <WindowsControls:TabItem.Header>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{StaticResource IconHistory}" />
                                <TextBlock Text="History" />
                            </StackPanel>
                        </WindowsControls:TabItem.Header>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition MinWidth="75" MaxWidth="400" Width="275"/>
                                <ColumnDefinition Width="5" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <WindowsControlsData:DataGrid 
                                Grid.Row="0" Grid.Column="0"
                                x:Name="HistoryResultGrid" 
                                AlternatingRowBackground="Beige" 
                                AutoGenerateColumns="False" 
                                CanUserResizeColumns="True"
                                HorizontalScrollBarVisibility="Auto"
                                VerticalScrollBarVisibility="Auto"
                                SelectionChanged="HistoryResultGrid_SelectionChanged"
                                >
                                    
                                <WindowsControlsData:DataGrid.Columns>
                                    <WindowsControlsData:DataGridTemplateColumn IsReadOnly="True" SortMemberPath="RunStatusOrdinal" Header="Result">
                                        <WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Image ToolTipService.ToolTip="{Binding RunStatus}" Source="{Binding RunStatusId, Converter={StaticResource StatusConverter}}" Height="16" Width="16" Stretch="None" />
                                            </DataTemplate>
                                        </WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                    </WindowsControlsData:DataGridTemplateColumn>
                                    <WindowsControlsData:DataGridTextColumn IsReadOnly="True" SortMemberPath="RunStartDate" Header="Started" Binding="{Binding RunStartDate, Converter={StaticResource RelativeDateConverter}}" />
                                    <WindowsControlsData:DataGridTextColumn IsReadOnly="True" Header="Duration" Binding="{Binding Duration, Converter={StaticResource DurationConverter}}" />
                                    <WindowsControlsData:DataGridTemplateColumn SortMemberPath="TestName" Header="Test Name">
                                        <WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding TestName, Converter={StaticResource TestNameConverter}}" VerticalAlignment="Center"/>
                                            </DataTemplate>
                                        </WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                        <WindowsControlsData:DataGridTemplateColumn.CellEditingTemplate>
                                            <DataTemplate>
                                                <TextBox Text="{Binding TestName}"/>
                                            </DataTemplate>
                                        </WindowsControlsData:DataGridTemplateColumn.CellEditingTemplate>
                                    </WindowsControlsData:DataGridTemplateColumn>
                                </WindowsControlsData:DataGrid.Columns>
                            </WindowsControlsData:DataGrid>

                            <WindowsControls:GridSplitter Style="{StaticResource GridSplitterVerticalStyle}" Grid.Row="0" Grid.Column="1" />

                            <QuailControls:TestRunLogsControl Grid.Row="0" Grid.Column="2" x:Name="HistoryTestRunLogs" RunStatusResult="{Binding SelectedHistoryTest}" />

                        </Grid>
                    </WindowsControls:TabItem>

                    <WindowsControls:TabItem x:Name="TabItemNoteHistory">
                        <WindowsControls:TabItem.Header>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{StaticResource IconNotes}" />
                                <TextBlock Text="Notes" />
                            </StackPanel>
                        </WindowsControls:TabItem.Header>

                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="25"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            
                            <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
                                <Button Margin="0,0,5,0" Click="AddNote_Click">
                                    <Image
                                        Stretch="None"
                                        Source="{StaticResource IconAdd}"
                                        ToolTipService.ToolTip="Add new note" />
                                </Button>

                                <Button Margin="0,0,5,0" Click="DeleteNote_Click" x:Name="DeleteNote" IsEnabled="False" >
                                    <Image
                                        Stretch="None"
                                        Source="{StaticResource IconDelete}"
                                        ToolTipService.ToolTip="Remove a note" />
                                </Button>

                                <Button Click="EditNote_Click" x:Name="EditNote" IsEnabled="False" >
                                    <Image
                                        Stretch="None"
                                        Source="{StaticResource IconEdit}"
                                        ToolTipService.ToolTip="Edit a note" />
                                </Button>
                            </StackPanel>
                            <WindowsControlsData:DataGrid 
                                x:Name="NotesResultGrid" 
                                AlternatingRowBackground="Beige" 
                                AutoGenerateColumns="False" 
                                CanUserResizeColumns="True"
                                HorizontalScrollBarVisibility="Auto"
                                VerticalScrollBarVisibility="Auto"
                                SelectionChanged="NotesResultGrid_SelectionChanged"
                                SizeChanged="NotesResultGrid_SizeChanged"
                                Grid.Row="1" Grid.Column="0"
                                Margin="0,5,0,0"
                                >

                                <WindowsControlsData:DataGrid.Columns>
                                    <WindowsControlsData:DataGridTextColumn IsReadOnly="True" SortMemberPath="CreatedBy" Header="Created By" Binding="{Binding CreatedBy}" />
                                    <WindowsControlsData:DataGridTextColumn IsReadOnly="True" SortMemberPath="CreateDate" Header="Created" Binding="{Binding CreateDate, Converter={StaticResource RelativeDateConverter}}" />
                                    <WindowsControlsData:DataGridTemplateColumn Header="Note">
                                        <WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBox Text="{Binding Note}" Height="80" MaxWidth="600" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" />
                                            </DataTemplate>
                                        </WindowsControlsData:DataGridTemplateColumn.CellTemplate>
                                    </WindowsControlsData:DataGridTemplateColumn>
                                </WindowsControlsData:DataGrid.Columns>
                            </WindowsControlsData:DataGrid>
                        </Grid>
                    </WindowsControls:TabItem>

                    <WindowsControls:TabItem x:Name="TabItemHelp">
                        <WindowsControls:TabItem.Header>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{StaticResource IconHelp}" />
                                <TextBlock Text="Help" />
                            </StackPanel>
                        </WindowsControls:TabItem.Header>
                            <SilverlightTools:HtmlHost 
                                SourceUri="{Binding HelpPage}"
                                />
                    </WindowsControls:TabItem>
                    <WindowsControls:TabItem x:Name="TabItemLoadTest">
                        <WindowsControls:TabItem.Header>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{StaticResource IconLoadTest}" />
                                <TextBlock Text="Load Tests" />
                            </StackPanel>
                        </WindowsControls:TabItem.Header>
                        <SilverlightTools:HtmlHost 
                                SourceUri="{Binding LoadTestsPage}"
                                />
                    </WindowsControls:TabItem>
                    <WindowsControls:TabItem x:Name="TabItemChart">
                        <WindowsControls:TabItem.Header>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{StaticResource IconChart}" />
                                <TextBlock Text="Charts" />
                            </StackPanel>
                        </WindowsControls:TabItem.Header>
                        <SilverlightTools:HtmlHost 
                                    SourceUri="{Binding TestChartsPage}"
                                    />
                    </WindowsControls:TabItem>
                </WindowsControls:TabControl>
                <!-- end lower section with test log results -->
                
            </Grid> <!-- end page grid-->
        </ScrollViewer> <!-- page scroller -->
        
        <!-- search modals -->
        <QuailControls:ProcessingModalControl Text="{Binding ProcessingText}"
                    ModalVisibility="{Binding IsProcessing, Converter={StaticResource VisibilityConverter}}" />
    </Grid>
</WindowsControlsNavigation:Page>
